<?php

namespace App\Http\Controllers;

use App\Models\Article;
use App\Models\Video;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class HomeController extends BaseController
{

    /**
     * 精选文章
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-02-27
     * @return void
     */
    public function featuredArticles()
    {
        $articles = new Article();
        $result = $articles->getRecommendArticle();
        return $this->success($result);
    }

    /**
     * 精选视频
     *
     * @Author hechengwei
     * @email chichiooo@sina.com
     * @DateTime 2024-02-27
     * @return void
     */
    public function featuredVideo()
    {
        $articles = Video::where(['status' => 1, 'recommend' => 1])->select('id', 'title', 'created_at')->limit(10)->get();
        return $this->success($articles);
    }
}
